package com.hyl.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * LoginContrller
 *
 * @author hyl
 * @date 2024-12-17
 */
@Controller
public class LoginCOntroller {

    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public String tologin(){
        System.out.println("进入登录页面");
        return "login";
    }

    @RequestMapping(value = "/login",method = RequestMethod.POST)
    public String login(@RequestParam("username") String username,
                        @RequestParam("password")String password){
        System.out.println("用户名："+username);
        System.out.println("密码"+password);
        return "index";
    }

    @RequestMapping(value = "/logout", method = RequestMethod.GET)
    public String logout(){
        return "login";
    }
}
